<template>
  <div class="flex wrap backgroundImg" id="box">
    <div class="meBox">
      <div class="headPhoto"></div>
      <div class="meBox-title column">
        <p>I'm {{ getOppoDetailInfo?.persoldate?.name }}</p>
        <div class="fg"></div>
      </div>
      <div class="meBox-text">
        <p>学历:{{ getOppoDetailInfo?.persoldate?.education }}</p>
        <p>学校:{{ getOppoDetailInfo?.persoldate?.school }}</p>
        <p>手机:{{ getOppoDetailInfo?.persoldate?.phone }}</p>
        <p>邮箱:{{ getOppoDetailInfo?.persoldate?.email }}</p>
        <p style="margin-top: 20px">
          {{ getOppoDetailInfo?.persoldate?.evaluate }}
        </p>
      </div>
    </div>
    <div id="cmdBox">
      <div class="cmd cmd1">
        <div class="title flex">
          <div class="click ac">
            <div class="red"></div>
            <div class="yellow"></div>
            <div class="green"></div>
          </div>
          <span>工作经历</span>
        </div>
        <div class="cmdText flex">
          <div style="width: 40%">
            <div
              v-for="item in JSON.parse(getOppoDetailInfo?.persoldate?.experience||'[]')"
              :key="item.id"
            >
              {{ item.time }}
            </div>
          </div>
          <div>
            <div
              v-for="item in JSON.parse(getOppoDetailInfo?.persoldate?.experience||'[]')"
              :key="item.id"
            >
              {{ item.company }}
            </div>
          </div>
        </div>
      </div>
      <div class="cmd cmd2">
        <div class="title flex">
          <div class="click ac">
            <div class="red"></div>
            <div class="yellow"></div>
            <div class="green"></div>
          </div>
          <span>专业技能</span>
        </div>
        <div class="cmdText">
          <div>
            <div v-for="item in getOppoDetailInfo?.proskill" :key="item.id">
              {{ item.professionalSkills }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { useAllStore } from "~/stores/index";
const store = useAllStore();
// 接口还是得watch 确保可以拿到
// 注意：接口返回的数据必须解构 不然获取会有问题
// 坑 对于pinia的持久缓存 存在问题 以此衍生出cookie怎么解决
// 对于需要缓存的数据 最好放pinia里面 并且可以在接口的时候就解构出来
// 问题1 跨域的解决 问题2 data能不能放方法里面 问题3：能不能切换的时候不执行 问题3 json
import { storeToRefs } from "pinia";
let { getOppoDetailInfo } =await storeToRefs(store);
let experience=JSON.parse(getOppoDetailInfo?.persoldate?.experience||'[]')

</script>
<style scoped lang="scss">
@keyframes meBox-text1 {
  0% {
    transform: translate(-500px, -500px) scale(0) rotate(180deg);
  }
  100% {
    transform: translate(0, 0);
  }
}
#box {
  box-sizing: border-box;
  padding-top: 120px;
  object-fit: cover;
  /* background-image: linear-gradient(to left, #e4e6d5, #eff6e8); */
  background-image: url("https://img0.baidu.com/it/u=4100541530,1907980949&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500");
  min-height: 100vh;
  height: 100%;
}
@media screen and (min-width: 1250px) {
  #box {
    /* background-image: linear-gradient(to left, #3498db, #2980b9); */
    /* background-image: url("https://img0.baidu.com/it/u=4100541530,1907980949&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500"); */
    /* background-image: url("http://25443402.s61i.faiusr.com/2/AD0IyviQDBACGAAgxKGW-AUos7qTwQYwgA844BM.jpg.webp"); */
  }
  .cmd1 {
    position: absolute;
    top: 0px;
  }
  .cmd2 {
    position: absolute;
    top: 150px;
    left: 100px;
  }
}
@keyframes meBox-text {
  0% {
    transform: translateY(40px);
    color: white;
  }
  100% {
    transform: translateY(0);
    color: rgb(70, 70, 70);
  }
}

.meBox {
  &:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
  }
  width: 290px;
  height: 350px;
  position: relative;
  background-color: white;
  margin: 100px;
  border-radius: 10px;
  animation-name: meBox-text1;
  animation-duration: 0.5s;
  @keyframes headPhotoed {
    100% {
      transform: rotate(1080deg);
    }
  }
  .headPhoto {
    width: 80px;
    height: 80px;
    background: url(https://q1.qlogo.cn/g?b=qq&nk=1656071287&s=640) no-repeat;
    background-size: cover;
    border-radius: 50%;
    position: absolute;
    top: -15%;
    animation-name: headPhotoed;
    animation-duration: 2s;
    left: 50%;
    margin-left: -40px;
  }

  .meBox-title {
    width: auto;
    margin: 0 auto;
    align-items: center;
    @keyframes typing {
      from {
        width: 0;
      }
    }
    @keyframes blink-caret {
      50% {
        border-color: transparent;
      }
    }
    p {
      font-size: 1.2rem;
      border-right: 0.1em solid;
      width: 9ch;
      white-space: nowrap;
      overflow: hidden;
      animation: typing 2s steps(20, end),
        blink-caret 0.3s step-end infinite alternate;
      margin: 30px 0 10px 0px;
      transition: all 0.3s;
    }
    .fg {
      width: 80%;
      height: 2px;
      background-image: linear-gradient(to left, #3498db, #2980b9);
    }
  }

  .meBox-text {
    width: 80%;
    overflow: hidden;
    text-align: center;
    color: rgb(70, 70, 70);
    animation-name: meBox-text;
    animation-duration: 2s;
    margin: 0 0 0 10%;
    transition: all 0.3s;
    /* p {
      margin-top: 5px;
    } */
  }
}

#cmdBox {
  width: 710px;
  height: 550px;
  position: relative;
  .cmd {
    width: 600px;
    animation-name: meBox-text1;
    animation-duration: 0.5s;
    height: 400px;
    border-radius: 10px 10px 5px 5px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s;
    font-size: 14px;
    color: rgb(88, 89, 92);
    .title {
      width: 100%;
      height: 40px;
      background-image: linear-gradient(to top, rgb(184, 184, 184), white);
      font-size: 14px;
      line-height: 25px;
      span {
        display: inline-block;
        width: 70%;
        text-align: center;
        font-weight: 600;
        font-size: 20px;
        line-height: 40px;
      }
    }
    .click {
      margin-left: 10px;
      div {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin: 8px 0 0 10px;
      }
      .red {
        background-color: #ff1b22;
        box-shadow: 0 0 1px #ff1b22;
        &:hover {
          background-color: #ff6268;
          box-shadow: 0 0 3px #ff1b22;
        }
      }
      .yellow {
        background-color: #ffaf00;
        box-shadow: 0 0 1px #ffaf00;
        &:hover {
          background-color: #ffd373;
          box-shadow: 0 0 3px #ffaf00;
        }
      }
      .green {
        background-color: #00931a;
        box-shadow: 0 0 1px #00931a;
        &:hover {
          background-color: rgb(0, 196, 36);
          box-shadow: 0 0 3px #00931a;
        }
      }
    }
    .cmdText {
      padding-top: 10px;
      padding-left: 15px;
      animation-name: meBox-text;
      animation-duration: 2s;
      line-height: 30px;
    }
    &:hover {
      width: 610px;
      height: 410px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
      margin: -5px 0 0 -5px;
      z-index: 1;
    }
  }
}

@media screen and (max-width: 1250px) {
  #box {
    flex-direction: column;
    .meBox {
      width: 90%;
      margin: 30px auto 20px;
      &:hover {
        transform: none;
        height: 360px;
      }
    }
  }
  #cmdBox {
    width: 100%;
    height: 850px;
    .cmd {
      width: 90%;
      margin: 0 auto;
      &:hover {
        width: 90%;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
        margin: 0 auto;
        z-index: 1;
      }
    }

    .cmd2 {
      position: relative;
      top: 20px;
      left: 0;
    }
  }
}
</style>
